package com.zhiwang.planet.mvvm.viewmodel.loginv2

import android.content.Context
import com.tencent.mm.opensdk.modelmsg.SendAuth
import com.tencent.mm.opensdk.openapi.WXAPIFactory
import com.zhiwang.planet.util.Store

class LoginUtil {

    companion object {
        fun wxLogin(context: Context) {
            val api = WXAPIFactory.createWXAPI(context, Store.APP_ID, false)
            api.registerApp(Store.APP_ID)
            val req = SendAuth.Req()
            req.scope = "snsapi_userinfo"
            req.state = "none"
            if (req.checkArgs()) {
                api.sendReq(req)
            }
        }
    }
}